feat: Move git clone management to a seperate API#58
Merged
Conversation
alecthomas
reviewed
Jan 23, 2026
| m.clones[upstreamURL] = repo | ||
| m.clonesMu.Unlock() | ||
|
|
||
| return nil |
Collaborator
There was a problem hiding this comment.
I think at this point we've discovered the git repo, so we can return fs.SkipDir to not recurse further.
Comment on lines
+266
to
+268
| "-c", "http.postBuffer="+strconv.Itoa(config.GitConfig.PostBuffer), | ||
| "-c", "http.lowSpeedLimit="+strconv.Itoa(config.GitConfig.LowSpeedLimit), | ||
| "-c", "http.lowSpeedTime="+strconv.Itoa(int(config.GitConfig.LowSpeedTime.Seconds())), |
|
|
||
| r.mu.Lock() | ||
| r.lastFetch = time.Now() | ||
| r.mu.Unlock() |
Collaborator
There was a problem hiding this comment.
Should we be keeping the lock while we're fetching?
Contributor
Author
There was a problem hiding this comment.
Yes... it also made me realise that I think we probably have another locking issue where we probably need read locks as well for consumers 🤔
| return | ||
| } | ||
| // #nosec G204 - repo.Path() is controlled by us | ||
| cmd := exec.CommandContext(ctx, "git", "-C", repo.Path(), "bundle", "create", "-", "--branches", "--remotes") |
Collaborator
There was a problem hiding this comment.
I don't think this should still be here?
Contributor
Author
There was a problem hiding this comment.
I think this was answered in #58 (comment)... correct me if there's a separate concern here.
alecthomas
reviewed
Jan 23, 2026
…ck/sfptc into johnm/refactor-git-clone-api
…uring read operations
alecthomas
approved these changes
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Migrates the git clone component of the git strategy into a separate API
Why?
Experimentation on implementing private repo support for the gomod strategy in #56 revealed we are likely better off separating the git clone behaviour so that it can be shared between multiple strategies.